package yhao.infra.feature.activemq.demo;

import org.springframework.context.annotation.Bean;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;

import jakarta.jms.ConnectionFactory;
import jakarta.jms.Session;

/**
 * @author yoara
 * <p> Created on 2019/8/12 </p>
 */
//@Configuration
//@Import(ActiveMqConfig.class)
public class ActiveMqConfiguration {
    @Bean("queueContainerFactory")
    public DefaultJmsListenerContainerFactory queueContainerFactory(
            ConnectionFactory amqCachingConnectionFactory){
        DefaultJmsListenerContainerFactory containerFactory = new DefaultJmsListenerContainerFactory();
        containerFactory.setConnectionFactory(amqCachingConnectionFactory);
        containerFactory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
        return containerFactory;
    }
}
